package com.iotechn.unimall.app.api.card;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.iotechn.unimall.core.exception.*;
import com.iotechn.unimall.data.domain.*;
import com.iotechn.unimall.data.enums.*;
import com.iotechn.unimall.data.mapper.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class CardServiceImpl implements CardService {

    private static final Logger logger = LoggerFactory.getLogger(CardServiceImpl.class);

    @Autowired
    private CardMapper cardMapper;

    @Override
    public List<CardDO> cardList(Integer pageNo, Integer limit) throws ServiceException {
        EntityWrapper<CardDO> wrapper = new EntityWrapper<>();
            wrapper.eq("status", StatusType.ACTIVE.getCode());
        List<CardDO> cardDOList = cardMapper.selectList(wrapper);

        return cardDOList;
    }

    @Override
    public CardDO getCardDO(Long cardId) throws ServiceException {
        return cardMapper.selectById(cardId);
    }
}
